﻿#region Using Statements
#endregion

using Casters.source.States.UIs;
using System.Collections.Generic;
namespace Casters.source.Managers
{
    /// <summary>
    /// Used to manage and draw UI over everything but the mouse
    /// </summary>
    static public class CUIManager
    {
        static public List<CBaseUI> m_ListOfUI = new List<CBaseUI>();

        static public void Initialize()
        {
        }

        /// <summary>
        /// Unloads all UI data
        /// </summary>
        static public void Shutdown()
        {
            for (int i = m_ListOfUI.Count - 1; i >= 0; --i)
            {
                m_ListOfUI[i].UnloadContent();
            }

            m_ListOfUI.Clear();
        }

        static public void AddUI(CBaseUI _ui)
        {
            _ui.Initialize();
            _ui.LoadContent();

            m_ListOfUI.Add(_ui);
        }

        static public void RemoveUI(CBaseUI _ui)
        {
            _ui.UnloadContent();
            m_ListOfUI.Remove(_ui);
        }

        static public void Update(float dt)
        {
            foreach (CBaseUI ui in m_ListOfUI)
                ui.Update(dt);
        }

        static public void Draw()
        {
            foreach (CBaseUI ui in m_ListOfUI)
                ui.Draw();
        }
    }
}
